<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('未分配员工')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="role-form">
				<input type="hidden" id="teaShopId" name="teaShopId" th:value="${teaShop.id}">
				<div class="select-list">
					<ul>
						<li>
							<label>职位：</label>
							<select name="position" th:with="type=${@dict.getType('employee_position')}">
								<option value="">所有</option>
								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
							</select>
						</li>
						<li>
							<label>姓名：</label>
							<input type="text" name="name"/>
						</li>
						<li>
							<label>手机号：</label>
							<input type="text" name="phone"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
	</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	var editFlag = [[${@permission.hasPermi('system:employee:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:employee:remove')}]];
    var positionDatas = [[${@dict.getType('employee_position')}]];
    var prefix = ctx + "system/shop/unAllocateEmployees";

    $(function() {
        var options = {
            url: prefix + "/unAllocatedList",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "茶店员工",
            columns: [{
                checkbox: true
            },
            {
                field: 'id',
                title: '员工编号',
            },
            {
                field: 'position',
                title: '职位',
                formatter: function(value, row, index) {
                   return $.table.selectDictLabel(positionDatas, value);
                }
            },
            {
                field: 'name',
                title: '姓名'
            },
            {
                field: 'phone',
                title: '手机号'
            }]
        };
        $.table.init(options);
    });
		/* 添加用户-选择用户-提交 */
		function submitHandler() {
			var rows = $.table.selectFirstColumns();
			if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		}
			var data = { "teaShopId": $("#teaShopId").val(), "employeeIds": rows.join() };
			$.operate.save(prefix + "/selectUnAllocateEmployeesAll", data);
		}
</script>
</body>
</html>